/**
 * @author Evgeny Sorokin
 */
Ext.define('USocial.store.FriendsStore', {
	extend : 'Ext.data.Store',
	
	requires : ['Ext.data.proxy.JsonP', 'USocial.model.User'],
	
	buildProxy : function(){
		this.setProxy({
			type : 'jsonp',
			url : 'https://api.vk.com/method/friends.get?fields=nickname,city,country,sex,photo_100,photo_50&access_token='+USocial.app.getUserInfo().get('token'),
			reader : {
				type : 'json',
				rootProperty : 'response'
			}
		});
	},
	
	getById: function(id) {
		return (this.snapshot || this.data).getByKey(id);
	},
	
	config : {
		model : 'USocial.model.User',
		
		singleton : true,
		buffered : true,
	}

});